]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dnd: Add a drag-cancelled signal
authorAlexander Larsson <alexl@redhat.com>
Tue, 8 Mar 2011 13:44:47 +0000 (14:44 +0100)
committerAlexander Larsson <alexl@redhat.com>
Wed, 9 Mar 2011 09:36:09 +0000 (10:36 +0100)
This lets us start the workspace zoom out animation right when the
snapback starts, rather than waiting for the snapback to finish.

https://bugzilla.gnome.org/show_bug.cgi?id=643786

js/ui/dnd.js
js/ui/overview.js
js/ui/workspace.js

index 87515563fd5ed7ccb53cf30d40fac5ac91fd52aa..46d32fdd3ed315095115266bfbca4c25404e9d48 100644 (file)
@@ -498,6 +498,7 @@ _Draggable.prototype = {
     },
 
     _cancelDrag: function(eventTime) {
+        this.emit('drag-cancelled', eventTime);
         this._dragInProgress = false;
         let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation();
 
index d5f7392724eb942f71bdf60eb1c9020e63069c91..2d672868fd878ec9b935fead2acf426a56eb60ff 100644 (file)
@@ -481,6 +481,10 @@ Overview.prototype = {
         this.emit('window-drag-begin');
     },
 
+    cancelledWindowDrag: function(source) {
+        this.emit('window-drag-cancelled');
+    },
+
     endWindowDrag: function(source) {
         this.emit('window-drag-end');
     },
index 8a6c05eeb18b178ac724e3d9ee6ef3240381136f..a6798cef2c6e5c5b1b74ecdd3830a567b9b81e7d 100644 (file)
@@ -125,6 +125,7 @@ WindowClone.prototype = {
                                               dragActorMaxSize: WINDOW_DND_SIZE,
                                               dragActorOpacity: DRAGGING_WINDOW_OPACITY });
         this._draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin));
+        this._draggable.connect('drag-cancelled', Lang.bind(this, this._onDragCancelled));
         this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd));
         this.inDrag = false;
 
@@ -292,6 +293,10 @@ WindowClone.prototype = {
         this.emit('drag-begin');
     },
 
+    _onDragCancelled : function (draggable, time) {
+        this.emit('drag-cancelled');
+    },
+
     _onDragEnd : function (draggable, time, snapback) {
         this.inDrag = false;
 
@@ -1231,6 +1236,10 @@ Workspace.prototype = {
                           Main.overview.beginWindowDrag();
                           overlay.hide();
                       }));
+        clone.connect('drag-cancelled',
+                      Lang.bind(this, function(clone) {
+                          Main.overview.cancelledWindowDrag();
+                      }));
         clone.connect('drag-end',
                       Lang.bind(this, function(clone) {
                           Main.overview.endWindowDrag();